import request from '@/utils/request'

// 用户列表
export function getUserList({ page, pageSize, query }) {
  return request({
    url: `admin/user/${page}/${pageSize}`,
    method: 'get',
    params: query
  })
}

// 用户选择列表
export function chooseUserList(data) {
  return request({
    url: `admin/user/choose`,
    method: 'get',
    params: data
  })
}

// 用户新增
export function addUser(data) {
  return request({
    url: `admin/user`,
    method: 'post',
    data
  })
}

// 用户详情
export function detailUser(id) {
  return request({
    url: `admin/user/${id}`,
    method: 'get'
  })
}

// 用户编辑
export function editUser(data) {
  return request({
    url: `admin/user/edit`,
    method: 'put',
    data
  })
}

// 用户删除
export function delUser(id) {
  return request({
    url: `admin/user/${id}`,
    method: 'delete'
  })
}

// 用户授权
export function editUserPermission(data) {
  return request({
    url: `admin/user/permission`,
    method: 'put',
    data
  })
}

// 用户启用
export function enableUser(id) {
  return request({
    url: `admin/user/enable/${id}`,
    method: 'put'
  })
}

// 用户停用
export function disableUser(id) {
  return request({
    url: `admin/user/disable/${id}`,
    method: 'put'
  })
}

// 用户重置密码
export function resetPasswordUser(id, data) {
  return request({
    url: `admin/user/reset-password/${id}`,
    method: 'put',
    data
  })
}

// 职务选择列表
export function chooseJobList(data) {
  return request({
    url: `admin/job/choose`,
    method: 'get',
    params: data
  })
}

// 获取用户默认权限
export function getUserPermissions() {
  return request({
    url: `admin/permissions/user`,
    method: 'get'
  })
}

// 虚拟业务员列表
export function getVirtualUserList({page, pageSize, query}, id) {
  return request({
    url: `admin/virtual-user/${id}/${page}/${pageSize}`,
    method: 'get',
    params: query
  })
}

// 虚拟业务员新增
export function addVirtualUser(data) {
  return request({
    url: `admin/virtual-user`,
    method: 'post',
    data
  })
}

// 虚拟业务员编辑
export function editVirtualUser(data) {
  return request({
    url: `admin/virtual-user/edit`,
    method: 'put',
    data
  })
}

// 虚拟业务员删除
export function delVirtualUser(id) {
  return request({
    url: `admin/virtual-user/${id}`,
    method: 'delete'
  })
}